#include "UdpServer.hpp"
#include "Daemon.hpp"
#include <iostream>
#include <unistd.h>
#include <stdio.h>
#include <string>
#include <vector>
#include <memory>

using namespace std;

void Usage(const string& proc)
{
    // cout << proc << " localip localport\n" << endl;
    cout << proc << " localport\n" << endl;
}


// ./udpserver localip localport
int main(int argc, char* argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(1);
    }

    uint16_t port = stoi(argv[1]);

    Daemon(true,true);
    lg.SwitchStyle(OneFile);
    // unique_ptr<UdpServer> uq = make_unique<UdpServer>(DefalutMessage,port);
    unique_ptr<UdpServer> uq = make_unique<UdpServer>(port);

    uq->Init();
    uq->Start();

    return 0;
}